<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<script type="text/javascript">
	function validation() {
		var frm = document.forms(0);
		if (frm.subject.value == "") {
			alert("제목을 입력해주세요.");
			return false;
		} else if (frm.nickname.value == "") {
			alert("이름을 입력해주세요.");
			return false;
		} else if (frm.whole.value == "") {
			alert("말머리를 선택해주세요.");
			return false;
		}else if (frm.content.value == "") {
			alert("내용을 입력해주세요.");
			return false;
		}
		return true;
	}
</script>
<h2 class="page_title"><strong>여자만 게시판</strong></h2>

<s:if test="reply">
<form action="ladyReplyAction.action" method="post" enctype="multipart/form-data" onsubmit="return validation();">
	<s:hidden name="ref" value="%{resultClass.ref}" />
	<s:hidden name="re_level" value="%{resultClass.re_level}" />
	<s:hidden name="re_step" value="%{resultClass.re_step}" />
</s:if>
<s:elseif test="resultClass == NULL">
	<form action="ladyWriteAction.action" method="post" enctype="multipart/form-data" onsubmit="return validation();">
</s:elseif>
<s:else>
	<form action="ladyModifyAction.action" method="post" enctype="multipart/form-data" onsubmit="return validation();">
		<s:hidden name="no" value="%{resultClass.no}" />
		<s:hidden name="currentPage" value="%{currentPage}" />
		<s:hidden name="old_file" value="%{resultClass.file_savname}" />
</s:else>
<P class="align_r">
	<font color="#FF0000">*</font>는 필수입력사항입니다.
</P>
<table class="table_form">
	<tr>
		<th><font color="#FF0000">*</font> 제목</th>
		<td><s:textfield name="subject"
				theme="simple" value="%{resultClass.subject}" cssStyle="width:370px"
				maxlength="50" />
		</td>
	</tr>
	<tr>
		<th><font color="#FF0000">*</font> id </th>
		<td>		
			<input type="text" name="id" value="${session.session_id}" maxlength="20" readonly="readonly"/>
		</td>
	</tr>
	<tr>
		<th><font color="#FF0000">*</font> 닉네임</th>
		<td>	
		<input type="text" name="nickname" value="${session.session_nickname}" maxlength="20" readonly="readonly"/>
		</td>
	</tr>
	<tr>
		<th><font color="#FF0000">*</font> 말머리</th>
		<td>
			<select name="whole">
				<option value="">말머리</option>
				<option value="자유">[자유]</option>
				<option value="질문">[질문]</option>
				<option value="건의">[건의]</option>
			</select>
		</td>
	</tr>
	<tr>
		<th><font color="#FF0000">*</font> 내용</th>
		<td><s:textarea name="content" theme="simple"
				value="%{resultClass.content}" cols="50" rows="10" />
		</td>
	</tr>
	<tr>
		<th>첨부파일</th>
		<td>
		<s:file name="upload" theme="simple" /> 
		<s:if test="resultClass.file_orgname != NULL">
		&nbsp; * <s:property value="resultClass.file_orgname" /> 파일이 등록되어 있습니다. 다시 업로드하면 기존의 파일은 삭제됩니다.
		</s:if>
		</td>
	</tr>
</table>
<p class="align_r">
	<input name="submit" type="submit" value="작성완료" class="inputb">
	<input name="list" type="button" value="목록" class="inputb"
		onClick="javascript:location.href='ladyListAction.action?currentPage=<s:property value="currentPage" />'">
</p>
</form>
